Database setup
Here starts the real stuff with the database. MaNGOS user creation Instead of using the root account of MySQL, it's safer to use a dedicated account. This account will have as username 'mangos', with password 'mangos_pass'. From a DOS prompt: mysql -u root -ppassword -v CREATE USER 'mangos'@'localhost' IDENTIFIED BY 'mangos_pass'; QUIT; Database creation The following scripts will build the 4 databases required to run MaNGOS and ScriptDev2 : *mangos *realm *characters *scriptdev2 mysql -u root -ppassword -v < X:\mangos\compile\mangos\sql\create_mysql.sql mysql -u root -ppassword -v < X:\mangos\compile\mangos\src\bindings\ScriptDev2\sql\scriptdev2_create_database.sql PSMDB import This procedure will import all the data to fill in the 4 tables. It's very easy. From the prompt : cd X:\mangos\repo\psmdb_wotlk\ PSDB_Installer.bat After you launch it, you will have to answer a few easy questions, but for most you may accept the default answer : . 8888888b. .d8888b. 8888888b. 888888b. (LK) 888 Y88b d88P Y88b 888 "Y88b 888 "88b 888 888 Y88b. 888 888 888 .88P 888 d88P "Y888b. 888 888 8888888K. 8888888P" "Y88b. 888 888 888 "Y88b 888 "888 888 888 888 888 888 Y88b d88P 888 .d88P 888 d88P 888 "Y8888P" 8888888P" 8888888P" Credits to: Factionwars, Nemok and BrainDedd What is your MySQL host name? localhost : What is your MySQL user name? root : What is your MySQL password? [ ] : password What is your MySQL port? 3306 : What is your World database name? mangos : What is your ScriptDev2 database name? scriptdev2 : What is your Characters database name? characters : What is your Realmd database name? realmd : Normally, you will just have to provide the root password. And if you used the provided scripts to create the databases, you won't have to edit their name. If this is the first time you install the database or if you are sure you want to restart from scratch, you may answer with 'yes' or 'y' to the following questions. This will wipe out your current World database and replace it. Do you wish to continue? (y/n) y This will wipe out your current ScriptDev2 database and replace it. Do you wish to continue? (y/n) y This will wipe out your current Characters database and replace it. Do you wish to continue? (y/n) y This will wipe out your current Realm database and replace it. Do you wish to continue? (y/n) y This will optimize your current database. Do you wish to continue? (y/n) y At the end, you will get : Done :) Press any key to continue . . . PSMDB & versions This is maybe the most important part to understand (at least before you plunge into the database structure). When a new release of PSMDB is coming out, it's tested and made compatible with some specific versions of MaNGOS and ScriptDev2. However, at the moment you have compiled those two components, there is a big chance that a new release version of those components has been released, and it's possible that the database has to be corrected to take this into account. I will detail the procedure by taking an example. You must first open the file "Supported_Revisions_&_Silvermoon_Contact.txt" found in the root of the PSMDB repository. Open it with Windows Explorer or type in : type "X:\mangos\repo\psmdb_wotlk\Supported_Revisions_&_Silvermoon_Contact.txt" The first lines of the file will display the following (date = 4th October 2010) : -------------------- Supported_Revisions -------------------- - WoW Client v3.3.5.12340 - MaNGOS r10551 & ScriptDev2 r1831 First, you will see that you have to use the Client with version v3.3.5.12340. Another version will not be compatible. The next line also reports that the db is compatible with MaNGOS r10551 and ScriptDev2 r1831. You should note down those numbers (as found in your setup). Next, you have to retrieve the current versions of MaNGOS and ScriptDev2 in your repository. Let's begin with MaNGOS: X: cd X:\mangos\repo\mangos git log -1 --pretty=oneline HEAD And it will display something like: 720153b8c36b5c3fecae13ccb7c9d39231b3c7af 10577 'shuttingdown' -> 'shutting down' in log In between the dashes, you will find the release number (or version), which is 10577 in this case. So, this means that from the release of PSMDB, MaNGOS has been updated from r10551 up to r10577. Write down the release number you found. Now, with ScriptDev2: X: cd X:\mangos\repo\ScriptDev2 svn log -r HEAD And it will display something like: ------------------------------------------------------------------------ r1833 | deverend | 2010-09-26 16:47:04 +0200 (zo, 26 sep 2010) | 2 lines Corrected typo in a file name. Patch by zergtmn. proffesor -> professor ------------------------------------------------------------------------ At the start of the second line, you will find the release number, which is r1833 in this case. So, like for MaNGOS, ScriptDev2 has been updated from r1831 up to 1833. Write down the release number you found. MaNGOS database updates To begin with, check which update files are delivered by MaNGOS: From the DOS command prompt dir X:\mangos\repo\mangos\sql\updates You will get something like this : ... 08/10/2010 15:49 381 10551_01_mangos_spell_proc_event.sql 08/10/2010 15:49 377 10568_01_characters_character_tutorial.sql 08/10/2010 15:49 2.130 10582_01_mangos_spell_proc_event.sql 19/10/2010 14:09 2.896 10604_01_mangos_spell_proc_event.sql 19/10/2010 14:09 1.430 10621_01_mangos_quest_template.sql ... Now, let's suppose that the PSMDB release you are using is compatible with MaNGOS 10551 and that you are using MaNGOS 10621. This means that you will have to update the database to make it compatible with MaNGOS 10621. Most updates apply on the mangos or character databases. The update files have the following format : ___.sql In the current example, you will apply the several update files with the following commands: X: cd X:\mangos\repo\psmdb_wotlk mysql -u root -ppassword -v -D characters < ..\mangos\sql\updates\10568_01_characters_character_tutorial.sql mysql -u root -ppassword -v -D mangos < ..\mangos\sql\updates\10582_01_mangos_spell_proc_event.sql mysql -u root -ppassword -v -D mangos < ..\mangos\sql\updates\10604_01_mangos_spell_proc_event.sql mysql -u root -ppassword -v -D mangos < ..\mangos\sql\updates\10621_01_mangos_quest_template.sql The syntax of the command is : mysql -u ' -p''' '''-v -D ' < '' It is important to note that : #You must apply each update in the right order. First follow the release number, then the index. #You must apply each update on the right database, most frequently on mangos or characters. #You must apply all updates, starting from the update with the next release following the release PSMDB is compatible with. And you must stop with the highest release equal or lower than the release of MaNGOS you are using. ScriptDev2 database updates